package com.qidian.mes.cal.controller;

import com.qidian.mes.cal.service.TeamMemberService;
import com.qidian.mes.cal.vo.TeamAndUserVO;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@CrossOrigin
@RequestMapping("/teamMember")
public class TeamMemberController {
    @Autowired
    TeamMemberService teamMemberService;

    @DeleteMapping("/deleteByIds")
    //删除班组成员
    public MESResult deleteByIds(Long[] memberIds) {
        return teamMemberService.deleteByIds(memberIds);
    }
    @GetMapping("/getAll")
    //获取所有成员
    public MESResult getAll() {
        return teamMemberService.getAll();
    }

    @PostMapping("/save")
    public MESResult save(@RequestBody TeamAndUserVO vo) {
        return teamMemberService.save(vo);
    }

    @GetMapping("/list")
    //根据班组编号查询班组成员
    public MESResult list(String teamCode) {
        return teamMemberService.list(teamCode);
    }

    @GetMapping("/selectByUserName")
    //根据用户名查询班组成员信息
    public MESResult selectByUserName(String userName) {
        return teamMemberService.selectByUserName(userName);
    }


}
